# 用户数据库
db = [
    ["admin","123456",1], # 1代表管理员
    ["lisi","123456",0] # 0 代表普通用户
]
# 家庭记录账单
finance = [
    ["类别","账户","金额","时间","说明"],
    ["吃饭支出","交通银行",247.8,"2016-03-12","家庭聚餐"],
    ["工资收入","现金",12345.0,"2016-03-15","开工资了"],
    ["服装支出","现金",1200.0,"2016-04-16","买衣服"],
    ["股票支出","工商银行",4500.36,"2017-05-06","股票大涨，买买买"],
]
count = 0
acc_type = -1  # -1用户类型为空
# 记录登陆状态
login_status = False # False 表示未登陆
while True:

    account = None
    password = None
    if not login_status:
        print("欢迎来到 House  Wife 家庭记账通系统".center(50, "-"))
        account = input("请输入登陆账号名：")
        password = input("请输入登陆密码：")


    for i in db:
        if i[0] == account  and i[1] == password:
            # 继续判断用户类型
            acc_type = i[2]
            break
    if acc_type == -1:
        count += 1
        if count != 3:
            print("对不起，你的账户名或者密码错误,请重新输入！")
        login_status = False
        if count == 3:
            print("对不起，你的账户名或者密码输入错误达到3次")
            break
        continue
    else:
        login_status = True
        print("登陆成功！欢迎来到系统！")
        if acc_type == 1:
            print("1.添加账务   2.编辑账务      3.删除账务      4.查询账务      5.退出系统")
            chose1 =int(input("请输入要操作的功能序号:"))
            if chose1 == 1:
                print("欢迎来到添加账务系统")
                row = []
                row.append((input("请输入类别："),input("请输入账户："),input("请输入金额："),input("请输入时间："),input("请输入说明：")))
                finance += row
                print(finance)
                re = int(input("退出系统请输入0:"))
                if re == 0:
                    break
            if chose1 == 2:
                print("欢迎来到编辑账务系统")
                re = int(input("退出系统请输入0:"))
                if re == 0:
                    break
            if chose1 == 3:
                print("欢迎来到删除账务系统")
                re = int(input("退出系统请输入0:"))
                if re == 0:
                    break
            if chose1 == 4:
                print("欢迎来到查询账务系统")
                re = int(input("退出系统请输入0:"))
                if re == 0:
                    break
            if chose1 == 5:
                print("退出系统成功")
                re = int(input("退出系统请输入0:"))
                if re == 0:
                    break
        elif acc_type == 0:
            print("1.查询所有   2.按条件查询")
            chose = input(">>>:")
            if chose == "1":
                print("".center(50,"-"))
                for i,v in enumerate(finance):
                    print(i,end="\t\t")
                    for value in v:
                        print(value,end="\t")
                    print()
                print("".center(50,"-"))
                re = int(input("退出系统请输入0，继续输入1:"))
                if re == 0:
                    break
                if re == 1:
                    pass
            elif chose == "2":
                print("1.ID     2.类别    3.账户    4.金额    5.时间")
                ch = []
                find = int(input("请输入你要查询的条件："))
                # 下面就是判断输入条件然后进行查询遍历即可，交给你们了
                if find == 1:
                    id_find = int(input("选择要查询的ID:"))
                    if id_find in finance:
                        print(finance[id_find])
                    else:
                        print("未找到该ID")
                    re = int(input("退出系统请输入0，继续输入1:"))
                    if re == 0:
                        break
                    if re == 1:
                        pass
                elif find == 2:
                    for i in range(1,5):
                        print(finance[i][0])
                    re = int(input("退出系统请输入0，继续输入1:"))
                    if re == 0:
                        break
                    if re == 1:
                        pass
                elif find == 3:
                    for i in range(1,5):
                        print(finance[i][1])
                    re = int(input("退出系统请输入0，继续输入1:"))
                    if re == 0:
                        break
                    if re == 1:
                        pass
                elif find == 4:
                    for i in range(1,5):
                        print(finance[i][2])
                    re = int(input("退出系统请输入0，继续输入1:"))
                    if re == 0:
                        break
                    if re == 1:
                        pass
                elif find == 5:
                    for i in range(1,5):
                        print(finance[i][3])
                    re = int(input("退出系统请输入0，继续输入1:"))
                    if re == 0:
                        break
                    if re == 1:
                        pass














